From 635dc946fe69efebd30f9301941db6047499df41 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 5 Mar 2008 09:43:03 +0000 Subject: [PATCH] ioemu: Slown down refresh interval when SDL is minimized as that saves us the VGA refresh scanning. Signed-off-by: Samuel Thibault --- tools/ioemu/sdl.c | 9 +++++++++ tools/ioemu/vl.c | 6 +++++- tools/ioemu/vl.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/ioemu/sdl.c b/tools/ioemu/sdl.c index 2f6701e254..c3be172122 100644 --- a/tools/ioemu/sdl.c +++ b/tools/ioemu/sdl.c @@ -518,6 +518,15 @@ static void sdl_refresh(DisplayState *ds) !ev->active.gain && !gui_fullscreen_initial_grab) { sdl_grab_end(); } + if (ev->active.state & SDL_APPACTIVE) { + if (ev->active.gain) { + /* Back to default interval */ + ds->gui_timer_interval = 0; + } else { + /* Sleeping interval */ + ds->gui_timer_interval = 500; + } + } break; default: break; diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c index b645ca3ea6..a5cc09ce19 100644 --- a/tools/ioemu/vl.c +++ b/tools/ioemu/vl.c @@ -6125,7 +6125,11 @@ QEMUMachine *find_machine(const char *name) void gui_update(void *opaque) { display_state.dpy_refresh(&display_state); - qemu_mod_timer(gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); + qemu_mod_timer(gui_timer, + (display_state.gui_timer_interval ? + display_state.gui_timer_interval : + GUI_REFRESH_INTERVAL) + + qemu_get_clock(rt_clock)); } struct vm_change_state_entry { diff --git a/tools/ioemu/vl.h b/tools/ioemu/vl.h index fcaf70488d..ff2f5463c4 100644 --- a/tools/ioemu/vl.h +++ b/tools/ioemu/vl.h @@ -935,6 +935,7 @@ struct DisplayState { int width; int height; void *opaque; + uint64_t gui_timer_interval; int switchbpp; int shared_buf; -- 2.30.2